package com.laozhao.msas.view;

import java.awt.event.ActionEvent;
import java.beans.PropertyChangeListener;
import java.util.HashMap;
import java.util.Map;

import javax.swing.Action;
import javax.swing.JOptionPane;

public class FileChooseAction extends FileChooseControl implements Action {

	
	private String name ;	
	private Map<String, Object> map = new HashMap<String, Object>();
	
	public FileChooseAction(String name){
		this.name = name;
		map.put(DEFAULT, "DEFAULT");
		map.put(NAME, "NAME:"+name);
		map.put(SHORT_DESCRIPTION, "short" +name);
		map.put(LONG_DESCRIPTION, "long"+name);
		map.put(SMALL_ICON, null);
		map.put(ACTION_COMMAND_KEY, "com"+name); 
		
	}
	
	@Override
	public void addPropertyChangeListener(PropertyChangeListener listener) {
		// TODO Auto-generated method stub

	}

	@Override
	public Object getValue(String key) {
		
		return map.get(key);
	}

	@Override
	public boolean isEnabled() {
		// TODO Auto-generated method stub
		return true;
	}

	@Override
	public void putValue(String key, Object value) {
		map.put(key, value);		 
	}

	@Override
	public void removePropertyChangeListener(PropertyChangeListener listener) {
		// TODO Auto-generated method stub

	}

	@Override
	public void setEnabled(boolean b) {
		// TODO Auto-generated method stub

	}

	@Override
	public void actionPerformed(ActionEvent e) {
		super.actionPerformed(e);
//		JOptionPane.showMessageDialog(null, "hello world!"+name+e.getActionCommand()+ e.getSource());
		System.out.println("hello world!"+name+e.getActionCommand());

	}

}
